package com.chagee.store.operation.server.service.biz;

import com.chagee.store.operation.common.exception.BizErrorCode;
import com.chagee.store.operation.common.exception.BizException;
import com.chagee.store.operation.server.entity.StoreDO;
import com.chagee.store.operation.server.model.param.StoreDetailParam;
import com.chagee.store.operation.server.model.vo.StoreDetailVO;
import com.chagee.store.operation.server.service.base.StoreBaseService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.tool.utils.BeanUtil;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Objects;

/**
 * @Author : hk
 * @Date : 2025/2/5
 */

@Service
@Slf4j
@RequiredArgsConstructor
public class StoreDetailBizService {

	@Resource
	private StoreBaseService storeBaseService;



	public StoreDetailVO queryStoreDetail(StoreDetailParam request) {
		StoreDetailVO detailVO = new StoreDetailVO();
		StoreDO storeDO = storeBaseService.batchQueryStoreInfo(request.getStoreNo());
		if (Objects.isNull(storeDO)) {
			throw new BizException(BizErrorCode.STORE_NO_FILE_ERROR);
		}
		BeanUtil.copyProperties(storeDO, detailVO);
		return detailVO;
	}
}
